/**
 * **************************************************************************************
 *
 * @Author 1044053532@qq.com
 * @License http://www.apache.org/licenses/LICENSE-2.0
 * **************************************************************************************
 */
package com.netty.constant;

import io.netty.util.AttributeKey;

public class Constants {

    public interface WebSite {
        int SUCCESS = 0;
        int ERROR = -1;
    }

    public interface ViewTemplateConfig {
        String template = "pctemplate/";
        String mobiletemplate = "mobiletemplate/";
    }

    public interface NotifyConfig {
        int NOTIFY_SUCCESS = 1;
        int NOTIFY_FAILURE = 0;
        int NOTIFY_NO_SESSION = 2;
    }


    public interface ImserverConfig {
        /**
         * 连接空闲时间 秒
         */
        int READ_IDLE_TIME = 60;
        /**
         * 发送心跳包循环时间- 秒
         */
        int WRITE_IDLE_TIME = 40;
        /**
         * 秒   需大于空闲时间
         * 心跳响应 超时时间
         */
        int PING_TIME_OUT = 70 * 1000;

        /**
         * 最大协议包长度
         * 10k
         */
        int MAX_FRAME_LENGTH = 1024 * 1024;

        int MAX_AGGREGATED_CONTENT_LENGTH = 65536;

        /**
         * 机器人SessionID
         */
        String REBOT_SESSIONID = "0";

        /**
         * websocket标识
         */
        int WEBSOCKET = 1;

        /**
         * socket标识
         */
        int SOCKET = 0;

        /**
         * dwr标识
         */
        int DWR = 2;


    }

    public interface DWRConfig {
        //dwr显示消息的script方法名
        String DWR_SCRIPT_FUNCTIONNAME = "showMessage";
        String SS_KEY = "scriptSession_Id";
        String BROWSER = "browser";
        String BROWSER_VERSION = "browserVersion";
    }

    public interface SessionConfig {
        String SESSION_KEY = "account";
        AttributeKey<String> SERVER_SESSION_ID = AttributeKey.valueOf(SESSION_KEY);
        AttributeKey SERVER_SESSION_HEARTBEAT = AttributeKey.valueOf("heartbeat");
    }

    public interface ProtobufType {
        /**
         * 请求
         */
        byte SEND = 1;
        /**
         * 接收
         */
        byte RECEIVE = 2;
        /**
         * 通知
         */
        byte NOTIFY = 3;
        /**
         * 回复
         */
        byte REPLY = 4;
    }

    public interface CmdType {
        /**
         * 绑定
         */
        byte BIND = 1;
        /**
         * 心跳
         */
        byte HEARTBEAT = 2;
        /**
         * 上线
         */
        byte ONLINE = 3;
        /**
         * 下线
         */
        byte OFFLINE = 4;
        /**
         * 消息
         */
        byte MESSAGE = 5;
        /**
         * 重连
         */
        byte RECON = 6;
    }

}
